home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 7 / BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso / Files / Tele / S / SetSoundVol.cpt / SetSoundVol < prev    next >
Text File  |  1991-03-03  |  4KB  |  109 lines

  1. ( SetSoundVol - White Knight procedure and RCMD
  2. ( to set the Macintosh speaker volume
  3.  
  4. ( This absolutely simple and mindless :-) procedure sets the speaker
  5. ( volume level.  It also returns the previous speaker volume level.
  6. ( I wrote this because I wanted to keep my speaker volume set at 0
  7. ( (flashing menu bar only) during most operations, but wanted to
  8. ( occasionally set the speaker volume to a higher level to alert me when
  9. ( I was away from the computer while waiting for a long downloading
  10. ( session to finish or while waiting to log into a busy BBS or campus
  11. ( computer system.
  12.  
  13. ( -----
  14.  
  15. ( NOTE:
  16.  
  17. ( This text file contains an RCMD resource in its resource fork.
  18. ( Make a backup copy of this file before editing it with any
  19. ( text editor or word processor which removes the resource fork
  20. ( from text files in the process of saving them.
  21.  
  22. ( A compiled copy of the procedure below is provided as the
  23. ( file, "SetSoundVol.PROC."  This text file, "SetSoundVol", is
  24. ( the source file from which White Knight generated that compiled procedure. 
  25.  
  26. ( -----
  27.  
  28. ( SUMMARY:
  29.  
  30. ( Sets the speaker volume to the value of the variable S9%.
  31. ( Returns the previous speaker volume in the variable S8%.
  32.  
  33. ( Returns a result code in the variable S7%:
  34. (   0  if the speaker volume was successfully set to the new level.
  35. (  -1  if the speaker volume could not be set to the requested level.
  36. (      (This would either be due to the speaker volume requested being
  37. (      outside the permissible range of 0 to 7, or if for some reason
  38. (      SetSoundVol failed to change the speaker volume.)
  39. ( -87  if the speaker volume could not be successfully written to
  40. (      parameter RAM (PRAM) (i.e. could not be read-verified).
  41.  
  42. ( This procedure *insists* on using these specific variables--S7%, S8%,
  43. ( and S9%.  If you have any values set for the variables S7% and S8%
  44. ( before calling this procedure, they are likely to be changed afterwards. 
  45.  
  46. ( It is good practice to return the speaker volume to its previous level
  47. ( after you have finished taking advantage of the new speaker volume
  48. ( in your procedures.
  49.  
  50. ( The following is one example of how you might call this procedure
  51. ( from your own White Knight procedures.  (Substitute the full pathname
  52. ( to this file, or the pathname from the folder where White Knight is
  53. ( located, for every instance of "PathtoSetSoundVolfile" below.):
  54.  
  55. (   --- Insert commands like the following into your own procedures: ---
  56.  
  57. (   ( Change the speaker volume to 5 by putting this value
  58. (   ( into S9% and calling the nested procedure, SetSoundVol.
  59. (   LET EQUAL S9%,5
  60. (   NEST PathtoSetSoundVolfile:SetSoundVol.PROC
  61.  
  62. (   ( Make some noise, using the new speaker volume.
  63. (   BELL
  64. (   BELL
  65.  
  66. (   ( Return the speaker volume to its previous level,
  67. (   ( which was returned in S8%.
  68. (   LET EQUAL S9%,S8%
  69. (   NEST PathtoSetSoundVolfile:SetSoundVol.PROC
  70.  
  71. ( -----
  72.  
  73. ( COPYRIGHT AND DISCLAIMER
  74.  
  75. ( Copyright ©1991 by Aron Roberts.
  76. ( May be freely distributed and used for any non-commercial and
  77. ( commercial purposes.  If you modify this RCMD or procedure and
  78. ( distribute the modified version, please add your own name to
  79. ( the modified copies.
  80.  
  81. ( Tested only on a Mac IIcx using System 6.0.7 and one specific
  82. ( set of INITs, so use at your own risk.  This RCMD does not try
  83. ( to do anything ambitious, however, so the risk should be minimal. 
  84.  
  85. ( Please send bug reports, suggestions for enhancements to:
  86. ( Preferred addresses:
  87. ( Internet: aron@garnet.berkeley.edu, BITNET: aron@ucbgarne.bitnet
  88. ( Also:
  89. ( CompuServe: 73075,1342, GEnie: ARON, America OnLine: ARON
  90.  
  91. ( Version 1.1, 3 March 1991.
  92. ( Now writes changed speaker volume setting to parameter RAM (PRAM).
  93.  
  94. ( Previous releases:
  95. ( Version 1.0, 2 March 1991.
  96.  
  97. ( Thanks to Doug Acker and Robert A. Daniel for the Think Pascal RCMD shell.
  98.  
  99.  
  100. ( -----
  101.  
  102. ( The actual commands in this procedure follow:
  103.  
  104. ( Call "SetSoundVol", the RCMD code resource contained in
  105. ( the resource fork of this file, with resource ID 280.
  106. RCMD 1,280
  107.  
  108. ( End the nested procedure.
  109. NESTEND